--#include "data\config\cross\CrossConfig.lua" once

local npcId = 151
NpcDialog[npcId] = {}
local t = NpcDialog[npcId]

t.main = function(sysarg)
	
	local isCross = Actor.IsCross(sysarg) 
	
	local strCond		= Lang.ScriptTips.x00230
	local strDesc 		= ""
	local okBtn 		= ""			--{按钮;样式;按钮名;函数名;描述}
	local strBtnList 	= ""

	if isCross then
		strDesc = Lang.ScriptTips.x00232
		okBtn 		= "{btn;0;".. Lang.ScriptTips.x00234 ..";%s;}"			--{按钮;样式;按钮名;函数名;描述}
		strBtnList 	= strBtnList .. string.format(okBtn, "EndCross")
	else
		strDesc = Lang.ScriptTips.x00231
		okBtn 		= "{btn;0;".. Lang.ScriptTips.x00233 ..";%s;}"			--{按钮;样式;按钮名;函数名;描述}
		strBtnList 	= strBtnList .. string.format(okBtn, "StartCross")
	end

	local pack = DataPack.allocPacket(sysarg, LogicCmd.npcDialogSys.sysID, LogicCmd.npcDialogSys.sub.sNpcDlgData)
	DataPack.writeUint64(pack, Actor.getNpc(sysarg))
	DataPack.writeByte(pack, NpcDialogType.GeneralNpcDlg)
	DataPack.writeString(pack, strCond)
	DataPack.writeString(pack, strDesc)
	DataPack.writeString(pack, strBtnList)
	DataPack.writeChar(pack, -1)
	DataPack.writeByte(pack, 0);
	DataPack.flush(pack)
end

t.StartCross = function(sysarg)
	local sVar = System.getStaticVar()
	if not sVar.crossBoss then
		Actor.sendTipmsg(sysarg, Lang.ScriptTips.x00235, ttFlyTip)
		return
	end

	local config = CrossConfig
	local circleLimit= config.levelLimit[1]
	local levelLimit = config.levelLimit[2]
	if not Actor.checkActorLevel( sysarg, levelLimit, circleLimit ) then
		Actor.sendTipmsg(sysarg, Lang.ScriptTips.COM0016, ttFlyTip)
		return	
	end

	Actor.StartCross(sysarg, config.enterPos[1], config.enterPos[2], config.enterPos[3])
end

t.EndCross = function(sysarg)
	Actor.EndCross(sysarg)
end


